@echo off
setlocal EnableDelayedExpansion
title 绝区零官B转换
:menu
cls
echo 请输入数字选择操作：
echo 1 - 启动官服
echo 2 - 启动B服
echo 3 - 退出
set "GamePath=E:\Programs\Mihoyo\miHoYo Launcher\games\ZenlessZoneZero Game"
set "ConfigPath=!GamePath!\config.ini"
:: 选择菜单
set /p userinput=请输入数字 (1, 2, 3): 

if "!userinput!"=="1" goto :executeA
if "!userinput!"=="2" goto :executeB
if "!userinput!"=="3" goto :eof
echo 输入无效，请输入1或2。

:: 子菜单操作
goto :menu
:executeA
echo 官服配置重写

echo "!ConfigPath!"
(
echo [general]
echo channel=1
echo sub_channel=2
echo cps=zzz_mktbackup2_pc
echo uapc={"hyp":{"uapc":""},"nap_cn":{"uapc":""}}
echo game_version=1.0.0
) > "!ConfigPath!"
echo "!ConfigPath!"
echo 官服配置已覆写
pause
goto :eof

:executeB
echo B服转换
set "DllPath=!GamePath!\ZenlessZoneZero_Data\Plugins\PCGameSDK.dll"
echo "!DllPath!"
if exist "!DllPath!" (
    echo DLL文件存在，执行覆写 
    (
    echo [general]
    echo channel=14
    echo sub_channel=0
    echo cps=zzz_mktbackup2_pc
    echo uapc={"hyp":{"uapc":""},"nap_cn":{"uapc":""}}
    echo game_version=1.0.0
    ) > "!ConfigPath!"
echo "!ConfigPath!"
echo B服配置已覆写

) else (
    echo 未找到B服Dll文件，请确认是否下载并放到指定位置。
    set "url=https://gitee.com/jinfeiteng/test/raw/master/PCGameSDK.dll"
    powershell -Command "(New-Object Net.WebClient).DownloadFile('!url!', '!DllPath!')"
    if exist "!DllPath!" (
        echo DLL文件已下载，执行覆写
        goto :executeB
    ) else (
        echo DLL文件下载失败，请检查网络连接。
    )
pause
)

goto :eof

:eof
endlocal

